package controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.Meat;
import service.MeatService;

/**
 * Servlet implementation class ShowMeat
 */
@WebServlet("/ShowMeat")
public class ShowMeat extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private MeatService ms;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ShowMeat() {
        super();
        // TODO Auto-generated constructor stub
        ms=new MeatService();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<Meat> meat_list=ms.getAll();
		request.setAttribute("meatlist", meat_list);
		request.getRequestDispatcher("meat.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
